package com.ndood.reconciliation.app.task;

import java.text.ParseException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.ndood.common.base.util.DateUtil;
import com.ndood.reconciliation.app.redis.RedisReconKeyHelper;
import com.ndood.reconciliation.app.redis.RedisTool;

@Component
public class ReconScheduleTask {

	@Autowired
	private RedisTool redisTool;
	
	@Scheduled(cron = "0 0 15 * * ?")
	public void taskRun() throws ParseException {
		String batchNo = DateUtil.getNatureDateSequence();
		
		// 1 官方支付宝对账
		String alipayBatchNo = RedisReconKeyHelper.alipayReconKey(batchNo);
		redisTool.saddReconKey(alipayBatchNo);
			
		// 2 官方微信对账
		String wechatBatchNo = RedisReconKeyHelper.wechatReconKey(batchNo);
		redisTool.saddReconKey(wechatBatchNo);
		
		// 3 银联对账
		String unionBatchNo = RedisReconKeyHelper.unionReconKey(batchNo);
		redisTool.saddReconKey(unionBatchNo);
	}

}
